#pragma once

namespace etcdv3 {

enum ErrCode {
    EcodeKeyNotFound      = 100,    // Key not found
    EcodeTestFailed       = 101,    // Compare failed
    EcodeNotFile          = 102,    // Not a file
    ecodeNoMorePeer       = 103,    // Reached the max number of peers in the cluster
    EcodeNotDir           = 104,    // Not a directory
    EcodeNodeExist        = 105,    // Key already exists
    ecodeKeyIsPreserved   = 106,    // The prefix of given key is a keyword in etcd
    EcodeRootROnly        = 107,    // Root is read only
    EcodeDirNotEmpty      = 108,    // Directory not empty
    ecodeExistingPeerAddr = 109,    // Peer address has existed
    EcodeUnauthorized     = 110,    // The request requires user authentication

    ecodeValueRequired        = 200,    // Value is Required in POST form
    EcodePrevValueRequired    = 201,    // PrevValue is Required in POST form
    EcodeTTLNaN               = 202,    // The given TTL in POST form is not a number
    EcodeIndexNaN             = 203,    // The given index in POST form is not a number
    ecodeValueOrTTLRequired   = 204,    // Value or TTL is required in POST form
    ecodeTimeoutNaN           = 205,    // The given timeout in POST form is not a number
    ecodeNameRequired         = 206,    // Name is required in POST form
    ecodeIndexOrValueRequired = 207,    // Index or value is required
    ecodeIndexValueMutex      = 208,    // Index and value cannot both be specified
    EcodeInvalidField         = 209,    // Invalid field
    EcodeInvalidForm          = 210,    // Invalid POST form
    EcodeRefreshValue         = 211,    // Value provided on refresh
    EcodeRefreshTTLRequired   = 212,    // A TTL must be provided on refresh

    EcodeRaftInternal = 300,            // Raft Internal Error
    EcodeLeaderElect  = 301,            // During Leader Election

    EcodeWatcherCleared     = 400,      // watcher is cleared due to etcd recovery
    EcodeEventIndexCleared  = 401,      // The event in requested index is outdated and cleared
    ecodeStandbyInternal    = 402,      // Standby Internal Error
    ecodeInvalidActiveSize  = 403,      // Invalid active size
    ecodeInvalidRemoveDelay = 404,      // Standby remove delay

    ecodeClientInternal = 500           // Client Internal Error
};

}
